{$layout "layout_popup"}

<h3>修改Fastcgi服务</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
    <csrf-token></csrf-token>

    <input type="hidden" name="fastcgiId" :value="fastcgi.id"/>
    <input type="hidden" name="paramsJSON" :value="JSON.stringify(params)"/>

    <table class="ui table definition selectable">
        <tr>
            <td class="title">Fastcgi地址</td>
            <td>
                <input type="text" name="address" placeholder="比如 127.0.0.1:9000" maxlength="100" style="width:14em" ref="focus" v-model="fastcgi.address"/>
            </td>
        </tr>
        <tr>
            <td>自定义参数集</td>
            <td>
                <div v-for="(param, index) in params">
                    <div class="ui field" style="margin:0" v-if="param.nameZh != null && param.nameZh.length > 0"><label>{{param.nameZh}}：</label></div>
                    <div class="ui fields inline" >
                        <div class="ui field">
                            <input type="text" name="paramNames" placeholder="参数名" v-model="param.name" style="width:12em" />
                        </div>
                        <div class="ui field">
                            <input type="text" name="paramValues" placeholder="参数值" v-model="param.value" style="width:16em"/>
                        </div>
                        <div class="ui field" style="padding:0">
                            <a href="" title="删除" @click.prevent="removeParam(index)"><i class="ui icon remove"></i> </a>
                        </div>
                    </div>
                </div>

                <p class="comment" v-if="params.length > 0">可以在参数值中使用一些变量<a href="https://goedge.cn/docs/Server/Variables.md" target="_blank">点这里查看</a> 。</p>

                <button class="ui button tiny" type="button" @click.prevent="addParam()">+</button>
            </td>
        </tr>
        <tr>
            <td colspan="2">
               <more-options-indicator></more-options-indicator>
            </td>
        </tr>
        <tbody v-show="moreOptionsVisible">
            <tr>
                <td>读取超时时间</td>
                <td>
                    <div class="ui right labeled input" style="width:7em">
                        <input type="number" name="readTimeout" maxlength="10" placeholder="比如 30" v-model="fastcgi.readTimeout.count"/>
                        <span class="ui basic label">秒</span>
                    </div>
                </td>
            </tr>
            <tr>
                <td>连接池尺寸</td>
                <td>
                    <input type="text" name="poolSize" value="0" maxlength="4" style="width:7em" v-model="fastcgi.poolSize"/>
                    <p class="comment">0表示不限制，通常可以设置为CPU数量的两倍</p>
                </td>
            </tr>
            <tr>
                <td>PATH_INFO匹配</td>
                <td>
                    <input type="text" name="pathInfoPattern" maxlength="100" v-model="fastcgi.pathInfoPattern"/>
                    <p class="comment">匹配PATH_INFO的正则表达式，用括号表示匹配的内容，如果只有一个匹配括号表示第一个括号为${fastcgi.pathInfo}值；如果有两个或两个以上的匹配括号，则第一个表示匹配的是${fastcgi.filename}，第二个匹配的是${fastcgi.pathInfo}，比如(\w+\.php)(.+)$。</p>
                </td>
            </tr>
            <tr>
                <td>是否启用</td>
                <td>
                    <checkbox name="isOn" value="1" v-model="fastcgi.isOn"></checkbox>
                </td>
            </tr>
        </tbody>
    </table>

    <submit-btn></submit-btn>
</form>